package com.qianli.user.facade.query.impl.base;

import com.fqgj.common.api.Response;
import com.qianli.user.application.UserBaseInfoApplication;
import com.qianli.user.facade.query.base.UserBaseInfoQueryServiceFacade;
import com.qianli.user.ro.UserStateCode;
import com.qianli.user.ro.base.UserBaseInfoRO;
import com.qianli.user.ro.query.UserBaseQueryRO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * name:基本信息查询
 * auth:ting.li@qianli-inc.com
 * date:2018/1/9 10:55
 * version: v1.0.0
 **/
@Service("userBaseInfoQueryServiceFacade")
public class UserBaseInfoQueryServiceFacadeImpl implements UserBaseInfoQueryServiceFacade{

    private static final Logger LOGGER = LoggerFactory.getLogger(UserBaseInfoQueryServiceFacade.class);

    @Autowired
    private UserBaseInfoApplication userBaseInfoApplication;

    @Override
    public Response<UserBaseInfoRO> getUserBaseInfo(UserBaseQueryRO queryRO) {
        if(null == queryRO){
            //LOGGER.info("UserBaseInfoQueryServiceFacade.getUserBaseInfo param can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK);
        }
        if(null == queryRO.getUserCode()){
            //LOGGER.info("UserBaseInfoQueryServiceFacade.getUserBaseInfo param userCode can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK);
        }
        if(null == queryRO.getAppCode()|| null == queryRO.getAppCode()){
            //LOGGER.info("UserBaseInfoQueryServiceFacade.getUserBaseInfo param appCode can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK);
        }
        Response<UserBaseInfoRO> response = userBaseInfoApplication.load(queryRO.getUserCode());
        return response;
    }
}
